#ifndef MSTAR_TV_H
#define MSTAR_TV_H
#include "data_struct.h"
//#include "marco_data.h"
#include <QFile>
#include<QString>
#include <QVariant>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;


class MSTAR_TV
{
    friend class translate;
public:
    MSTAR_TV();
     //   MSTAR_TV(QString &,QString &,QString &）；
     MSTAR_ATV_DATA *mstar_atv;//存储了所有的ATV频道信息
     MSTAR_DTV_DATA *mstar_dtv_data;
     QList<MSTAR_DTV_DATA *> mstar_dtv;

private:
     //This record the current dtv numbers
     uint count_dtvb;
     uint count_dtvc;
     //This record the original dtv numbers which in tv file.
     //They will be used in Write_DTV_BIN()when datas,edited，write to tv files.
     uint old_cou_dtvb;
     uint old_cou_dtvc;
     uint count_atv;
     uint empty;//record the open tv files times.if(times>1) I let clear datas.
private:
     bool read_atv;
     uint Read_DTV_Bin(const char*);//dtvb and dtvc read file func
     void Write_DTV_Bin(const char*,const uint  count,uint);
     void Copy_File(const char *src,const char *dst,const uint src_start,const uint dst_start,const uint len);//the two file
     //usually is the same ,but  for more useful with the function,I choice two start variable.
     void Mod_Check(ushort nun1,ushort num2);
public:
//interface to TCL_MSTAR_ATV_TV  and　TCL_MSTAR_DTV_TV
     void Read_ATV();
     void Read_DTV();
     void Write_ATV();
     void Write_DTV();
     uint Count_ATV();

     bool Is_Empty();
     void Clear();
     void Empty_Add_One();
     void Empty_Dul_One();
     void set_Empty(uint);

     uint Get_DTV_Count();
     void Del_ATV_Row(int row);
     void Del_DTV_Row(int row);

     void Mod_ATV(int row,int col,QString );
     void Mod_DTV(int row,int col,QString value);



};

#endif // MSTAR_TV_H
